package nowcoder.written_examination.jd;

import org.junit.Test;

/**
 * @author fance
 * @date 18-7-4 上午5:29
 */
public class Solution {

    public int countWays(int n) {
        n = n - 1;
        if (n < 1) {
            return  0;
        }
        if (n == 1 || n == 2) {
            return n;
        }
        int pre = 2;
        int prepre = 1;
        int res = 0;
        for (int i = 3; i <= n; i++) {
            res = pre + prepre;
            prepre = pre;
            pre = res;
            res %= 1000000007;
            prepre %= 1000000007;
            pre %= 1000000007;
        }
        return res;
    }
    public int calcDistance(int A, int B, int C, int D) {
        // write code here
        return calcDistanceCore(A) + calcDistanceCore(B) +
        calcDistanceCore(C) + calcDistanceCore(D);
    }
    public int calcDistanceCore(int n) {
        // write code here
        return 3 * n;
    }
    @Test
    public void test() {
        System.out.println(countWays(96));
    }
}
